import threading

# 多线程案例！ 老刘
class SellTicketThread(threading.Thread):
    # 定义售票的数量
    ticket = 100  # 类属性 被所有对象共享

    def run(self):
        while self.ticket > 0:
            SellTicketThread.ticket -= 1
            print("{}卖出了一张票,剩余{}".format(self.name,self.ticket))


if __name__ == '__main__':
    seller1 = SellTicketThread()
    seller2 = SellTicketThread()

    seller1.start()
    seller2.start()

